package com.phamkhanh.domain;

// default package
// Generated Oct 14, 2012 11:06:17 PM by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "findyourphone", uniqueConstraints = @UniqueConstraint(columnNames = "Email"))
public class User implements java.io.Serializable {

	private Integer uid;
	private String userName;
	private String password;
	private String email;
	private Set<Sim> sims = new HashSet<Sim>(0);
	private Set<Gps> gpses = new HashSet<Gps>(0);

	public User() {
	}

	public User(String userName, String password, String email) {
		this.userName = userName;
		this.password = password;
		this.email = email;
	}

	public User(String userName, String password, String email, Set<Sim> sims,
			Set<Gps> gpses) {
		this.userName = userName;
		this.password = password;
		this.email = email;
		this.sims = sims;
		this.gpses = gpses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "UID", unique = true, nullable = false)
	public Integer getUid() {
		return this.uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	@Column(name = "UserName", nullable = false, length = 45)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "Password", nullable = false, length = 100)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "Email", unique = true, nullable = false, length = 45)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Sim> getSims() {
		return this.sims;
	}

	public void setSims(Set<Sim> sims) {
		this.sims = sims;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Gps> getGpses() {
		return this.gpses;
	}

	public void setGpses(Set<Gps> gpses) {
		this.gpses = gpses;
	}

	@Override
	public String toString() {
		return "User [uid=" + uid + ", userName=" + userName + ", password="
				+ password + ", email=" + email +"]";
	}
	
	

}
